package com.designpattern.adapter;

/**
 * 项目名称: java_algorithm
 * @ClassName AdapterTest2
 * @Description
 * @Author huipanxing huipanxing@chinasofti.com   @Date 2021/9/9 16:08
 */
public class AdapterTest2 {
    public static void main(String[] args) {
        Target2 target2=new Adapter2();
        target2.output5v();
    }
}

class Adaptee2 {
    public int outPut220v() {
        return 220;
    }
}

interface Target2 {
    int output5v();
}

//类的适配器模式
class Adapter2 extends Adaptee2 implements Target2 {

    @Override
    public int output5v() {
        int i = outPut220v();
        System.out.println(String.format("原始电压：%d->输出电压：%d", i, 5));
        return 5;
    }
}